﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ep_stock.aspx.cs" Inherits="ePioneer_ep_stock" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title></title>
    <link href="css/m_dp01.css" rel="stylesheet" type="text/css" />
    <link href="css/main.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="Javascript/jq.js"></script>
    <script type="text/javascript" src="Javascript/jq.Slide.js"></script>
    <script type="text/javascript" src="javascript/jq_fn.js"></script>
</head>
<body style="border-style: none" scroll="no" topmargin="0" leftmargin="0">
    <form id="form1" runat="server">
    <script type="text/javascript" language="javascript">
        var tsecTab = 0;
        $(document).ready(function () {
            GetSeriesList(0);
            GetMagnifier(5);
            GetNoticeDataList(0);
        });

        //获取放大镜的数据
        function GetMagnifier(counts) {
            //            $.ajax({
            //                type: "POST",
            //                url: "ep_question.ashx",
            //                dataType: "html",
            //                data: { action: "GetMagnifier", counts: counts },
            //                success: function (result) {
            //                    $("#gaoshoufangda").html(result);
            //                }
            //            });
            $.ajax({
                type: "POST",
                url: "ep_question.ashx",
                dataType: "json",
                data: { action: "GetRankingList", tid: 0 },
                success: function (result) {
                    $("#rankinglist").html(GetRankingHtml(result));
                    $("#gaoshoufangda").html(GetMagnifierHtml(result));
                }
            });
        }

        //计算字符串的字节数
        function getByteLen(str) {
            var l = str.length;
            var n = l;
            for (var i = 0; i < l; i++) {
                if (str.charCodeAt(i) < 0 || str.charCodeAt(i) > 255) {
                    n++;
                }
            }
            return n;
        }

        //获取放大镜数据HTML
        function GetMagnifierHtml(data) {
            var html = "";

            var tNode;

            if (data != null && data["code"] == 0 && data["data"]["list"] != "") {
                for (var i = 0; i < 3; i++) {
                    var picUrl = data["data"]["list"][i]["picUrl"] == "" ? "m1" : data["data"]["list"][i]["picUrl"];
                    var nickName = data["data"]["list"][i]["nickName"] == "" ? " " : data["data"]["list"][i]["nickName"];
                    var uname = $.trim(nickName);
                    if (getByteLen(uname) > 8) {
                        uname = uname.substr(0, 4) + "...";
                    }
                    var uin = data["data"]["list"][i]["uin"] == "" ? " " : data["data"]["list"][i]["uin"];
                    var url = data["data"]["list"][i]["url"] == "" ? "http://finance.qq.com/chaogu/u/?uin=" + uin : data["data"]["list"][i]["url"];
                    picUrl = "http://mat1.gtimg.com/finance/st/p/chaogu/images/" + picUrl + ".jpg";
                    html += "<li><div><a href='" + url + "' target='_blank'><img src='" + picUrl + "' width='55' height='55' /></a></div><div style='padding-top:5px;' title='" + nickName + "'>" + uname + "</div><div style='padding-top:5px;'>虚拟盘第" + (i + 1) + "名</div><div style='padding-top:5px;'><a href='" + url + "' target='_blank'><span class='cblue1'>点击追踪Ta</span></a></div></li>";
                }
            }
            else {
                html += "<li><br /><div>暂无数据</div></li>";
            }
            return html;
        }

        //按日周月总获取大赛数据中心
        function GetSeriesList(did) {
            $("#hiddid").val(did);
            $(".mgddown_right .tabsup .labbar1 .labs").removeClass("onover");
            $(".mgddown_right .tabsup .labbar1 .labs:first").addClass("onover");
            $.ajax({
                type: "POST",
                url: "ep_question.ashx",
                dataType: "json",
                data: { action: "GetSeriesDataList", tid: 0, did: did },
                success: function (result) {
                    $("#seriesdatalist").html(GetSeriesHmtl(result, 0));
                }
            });
        }

        //数据中心
        function GetSeriesHmtl(data, iType) {
            var html = "<div class='labcntshow'><div class='logoimg'><img src='images/dp_gdzg_dasai00" + (iType + 1) + ".jpg' title='' /></div>";
            if (data != "" && data != null && data["code"] == 0 && data["data"] != "") {
                for (var i = 0; i < 3; i++) {
                    var zqjc = data["data"][i]["zqjc"] == "" ? "0" : data["data"][i]["zqjc"];
                    var zqdm = data["data"][i]["zqdm"] == "" ? "0" : data["data"][i]["zqdm"];
                    if (zqdm != "0") {
                        zqdm = zqdm.substr(zqdm.length - 6, 6);
                    }
                    var count = data["data"][i]["count"] == "" ? "0%" : data["data"][i]["count"];
                    html += "<span>" + zqdm + "</span><span style='margin-left:15px;'>" + count + "人持有<span><br />";
                }
            }
            else {
                //var zqdm = "sh600600";
                html += "<span>暂无数据</span>"; //"<span>" + zqdm + "</span><span style='margin-left:15px;'>1455444455人持有<span><br />";
            }
            html += "<div class='clr'></div></div>";
            return html;
        }

        //按卖入买出重仓获取大赛数据中心
        function GetSeriesDataList(tid) {
            var did = $("#hiddid").val();
            $.ajax({
                type: "POST",
                url: "ep_question.ashx",
                dataType: "json",
                data: { action: "GetSeriesDataList", tid: tid, did: did },
                success: function (result) {
                    $("#seriesdatalist").html(GetSeriesHmtl(result, tid));
                }
            });
        }
        //按日周月总获取大赛排行榜
        function GetRankingList(tid) {
            tsecTab = tid;
            $.ajax({
                type: "POST",
                url: "ep_question.ashx",
                dataType: "json",
                data: { action: "GetRankingList", tid: tid },
                success: function (result) {
                    $("#rankinglist").html(GetRankingHtml(result));
                }
            });
        }

        //按日周月总获取大赛排行榜
        function GetRankingHtml(data) {
            var html = "<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
            html += "<tr class='tbbgc_o'><td width='40' align='center'>排名</td><td width='80'>昵称</td><td>总资产</td><td width='65'>";
            var str = "总盈利率";
            if (tsecTab == 1) {
                str = "周盈利率";
            }
            if (tsecTab == 2) {
                str = "日盈利率";
            }
            html += str;
            html += "</td><td width='65'>仓位</td><td>盈利</td><td width='50'>操作</td></tr>";
            if (data != null && data["code"] == 0 && data["data"]["list"] != "") {
                for (var i = 0; i < 8; i++) {
                    var zczz = data["data"]["list"][i]["zczz"] == "" ? "0.00" : data["data"]["list"][i]["zczz"];
                    var cw = data["data"]["list"][i]["cw"] == "" ? "0.00" : data["data"]["list"][i]["cw"];
                    var syl = data["data"]["list"][i]["zsy"] == "" ? "0.00" : data["data"]["list"][i]["zsy"];
                    if (tsecTab == 1) {
                        syl = data["data"]["list"][i]["zhsy"] == "" ? "0.00" : data["data"]["list"][i]["zhsy"];
                    }
                    if (tsecTab == 2) {
                        syl = data["data"]["list"][i]["rsy"] == "" ? "0.00" : data["data"]["list"][i]["rsy"];
                    }
                    var yk = zczz - 500000; //data["data"]["list"][i]["yk"] == null ? "0" : data["data"]["list"][i]["yk"];
                    var uin = data["data"]["list"][i]["uin"] == "" ? " " : data["data"]["list"][i]["uin"];
                    var nickName = data["data"]["list"][i]["nickName"] == "" ? " " : data["data"]["list"][i]["nickName"];
                    var uname = $.trim(nickName);
                    if (getByteLen(uname) > 8) {
                        uname = uname.substr(0, 4) + "...";
                    }
                    var url = data["data"]["list"][i]["url"] == "" ? "http://finance.qq.com/chaogu/u/?uin=" + uin : data["data"]["list"][i]["url"];
                    zczz = parseFloat(zczz).toFixed(2);
                    cw = parseFloat(cw).toFixed(2);
                    syl = parseFloat(syl).toFixed(2);
                    yk = parseFloat(yk).toFixed(2);
                    uin = uin.substring(0, 3) + "***" + uin.substring(uin.length - 3);
                    if (i % 2 == 0) {
                        html += "<tr>";
                    }
                    else {
                        html += "<tr class='tbbgc_o'>";
                    }
                    html += "<td align='center'>" + (i + 1) + "</td><td title='" + nickName + "'>" + uname + "</td><td>￥" + zczz + "</td><td class='cred'>" + syl + "%</td><td>" + cw + "%</td><td>￥" + yk + "</td><td><a href='" + url + "' target='_blank'><span class='cblue1'>追踪ta</span></a></td></tr>";
                }
            }
            else {
                html += "<tr><td colspan='6'>暂无数据</td></tr>";
            }
            html += "</table>";
            return html;
        }

        //获取专家每日点评和大赛公告
        function GetNoticeDataList(tid) {
            $.ajax({
                type: "POST",
                url: "ep_question.ashx",
                dataType: "html",
                data: { action: "GetNoticeDataList", tid: tid },
                success: function (result) {
                    $("#noticedatalist").html(result);
                }
            });
        }
    </script>
    <div class="dp_m" style="width: 790px; height: 465px; background-color: #fff;">
        <div class="cnt" style="width: 790px; height: 465px; border-left: #fff 0px solid;
            border-right: #fff 0px solid; background-image: none;">
            <!--战法详细内容-->
            <div class="mbody_gd01" style="background-color: #fff;">
                <div class="mgd_up">
                    <div class="adshow">
                        <a href="http://finance.qq.com/chaogu/" target="_blank">
                            <img src="ad_images/dp_gdzg001.jpg" width="505" height="168" alt="点击进入比赛" /></a>
                    </div>
                    <div class="mgdup_right">
                        <div class="topshow">
                            <div class="toptit">
                            </div>
                        </div>
                        <div class="cntshow">
                            <div class="slidshowbox" style="overflow: hidden;">
                                <ul class='gaoshou' id="gaoshoufangda">
                                </ul>
                            </div>
                            <div class="goleft" style="display: none;">
                            </div>
                            <div class="goright" style="display: none;">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="mgd_bar">
                    <div class="barmenu01">
                        <ul>
                            <li><a href="http://finance.qq.com/chaogu/" target="_blank" style="color: #fff;">大赛首页</a></li><li>
                                <a href="http://finance.qq.com/chaogu/scyl.htm" target="_blank" style="color: #fff;">
                                    赛程一览</a></li><li><a href="http://finance.qq.com/chaogu/jpsz.htm" target="_blank"
                                        style="color: #fff;">奖项设置</a></li><li><a href="http://finance.qq.com/chaogu/mngz.htm"
                                            target="_blank" style="color: #fff;">交易规则</a></li><li><a href="http://finance.qq.com/chaogu/game/"
                                                target="_blank" style="color: #fff;">交易中心</a></li><li><a href="http://finance.qq.com/chaogu/u/mine.html"
                                                    target="_blank" style="color: #fff;">个人中心</a></li></ul>
                    </div>
                    <div class="bartimesort">
                    </div>
                    <div class="bartimesort" style="position: absolute; width: 500px;">
                        <a href="javascript:void(0)" onclick="GetRankingList(2)"><span class="cwhite">日</span></a>
                        / <a href="javascript:void(0)" onclick="GetRankingList(1)"><span class="cwhite">周</span></a>
                        / <a href="javascript:void(0)" onclick="GetRankingList(0)"><span class="cwhite">总</span></a>
                    </div>
                </div>
                <div class="mgd_down">
                    <div class="mgddown_left">
                        <div id="rankinglist">
                        </div>
                    </div>
                    <div class="mgddown_right">
                        <div class="tabsup">
                            <div class="labbar1">
                                <div class="labs onover">
                                    买入最多</div>
                                <div class="labs">
                                    卖出最多</div>
                                <div class="labs">
                                    重仓股</div>
                            </div>
                            <div class="labcnt1">
                                <div id="seriesdatalist">
                                </div>
                            </div>
                        </div>
                        <div class="tabsdown">
                            <div class="labbar2">
                                <div class="labs2 onover">
                                    精彩视频</div>
                                <div class="labs2">
                                    大赛公告</div>
                            </div>
                            <div class="labcnt2">
                                <div class='labcntshow2' id="noticedatalist">
                                </div>
                            </div>
                        </div>
                    </div>
                    <script type="text/javascript">
                        $labssel1 = $(".mgddown_right .tabsup .labbar1 .labs");
                        $labssel2 = $(".mgddown_right .tabsdown .labbar2 .labs2");
                        $labsscnt1 = $(".mgddown_right .tabsup .labcnt1 .labcntshow");
                        $labsscnt2 = $(".mgddown_right .tabsdown .labcnt2 .labcntshow2");
                        $labssel1.click(function () {
                            $labssel1.removeClass("onover");
                            $(this).addClass("onover");
                            var tid = $labssel1.index($(this)[0]);
                            GetSeriesDataList(tid);
                        });
                        $labssel2.click(function () {
                            $labssel2.removeClass("onover");
                            $(this).addClass("onover");
                            var tid = $labssel2.index($(this)[0]);
                            GetNoticeDataList(tid);
                        });

                    </script>
                </div>
            </div>
            <!--战法详细结束-->
            <input type="hidden" id="hidtid" runat="server" />
            <input type="hidden" id="hiddid" />
        </div>
    </div>
    </form>
</body>
</html>
